From: Ævar Arnfjörð Bjarmason Date: Sun, 26 Mar 2006 02:38:01 +0000 (+0000) Subject: * Patch by Ivan Krstic to fix a parser test case X-Git-Tag: 1.6.0~128 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=08e09ce35e83fb7fb2859c414287bada4c718e16;p=lhc%2Fweb%2Fwiklou.git * Patch by Ivan Krstic to fix a parser test case --- diff --git a/includes/Parser.php b/includes/Parser.php index 00dfae2808..a846fc80f5 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -473,11 +473,9 @@ class Parser } # Comments - if($stripcomments) { - $text = Parser::extractTags(STRIP_COMMENTS, $text, $comment_content, $uniq_prefix); - foreach( $comment_content as $marker => $content ){ - $comment_content[$marker] = ''; - } + $text = Parser::extractTags(STRIP_COMMENTS, $text, $comment_content, $uniq_prefix); + foreach( $comment_content as $marker => $content ){ + $comment_content[$marker] = ''; } # Extensions @@ -501,6 +499,16 @@ class Parser } } + # Unstrip comments unless explicitly told otherwise. + # (The comments are always stripped prior to this point, so as to + # not invoke any extension tags / parser hooks contained within + # a comment.) + if ( !$stripcomments ) { + $tempstate = array( 'comment' => $comment_content ); + $text = $this->unstrip( $text, $tempstate ); + $comment_content = array(); + } + # Merge state with the pre-existing state, if there is one if ( $state ) { $state['html'] = $state['html'] + $html_content;